package com.liumingtai.demo01.web.controller;

import com.liumingtai.demo01.common.utils.R;
import com.liumingtai.demo01.dto.module.email.EmailDto;
import com.liumingtai.demo01.modules.email.service.EmailService;
import jdk.nashorn.internal.ir.annotations.Reference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/web")
public class WebController {

    //    @Autowired
//    EmailFeign emailFeign;

    @Reference
    EmailService emailService;

    @PostMapping("/email")
    public R sendEmail(@RequestBody EmailDto emailDto) {
        return R.ok(emailService.send("liumingtai@coolgua.com", emailDto.getReceiver(), emailDto.getTitle(), emailDto.getText()));
    }
}
